<?php
import( 'de.ceus-media.framework.krypton.core.DefinitionAction' );
/**
 *	Log out Action.
 *	@package		mv2.action.authentification
 *	@extends		CMF_Krypton_Core_DefinitionAction
 *	@author			Christian Würker <Christian.Wuerker@CeuS-Media.de>
 *	@since			23.04.2007
 *	@version		0.1
 */
/**
 *	Log out Action.
 *	@package		mv2.action.authentification
 *	@extends		CMF_Krypton_Core_DefinitionAction
 *	@author			Christian Würker <Christian.Wuerker@CeuS-Media.de>
 *	@since			23.04.2007
 *	@version		0.1
 */
class Action_Authentication_Logout extends CMF_Krypton_Core_DefinitionAction
{
	/**
	 *	Constructor.
	 *	@access		public
	 *	@return		void
	 */
	public function __construct()
	{
		parent::__construct();
		$this->loadLanguage( 'auth' );
		$this->addAction( 'logoutUser' );
	}
		
	/**
	 *	Logs out an User.
	 *	@access		protected
	 *	@return		void
	 */
	protected function logoutUser()
	{
		$request	= $this->registry->get( 'request' );
		$session	= $this->registry->get( 'session' );
		$auth		= $this->registry->get( 'auth' );
		$words		= $this->words['auth']['msg'];

		if( $auth->isAuthenticated() )
		{
			$auth->logout();
			$this->messenger->noteSuccess( $words['success_logout'] );
//			if( $referer = $session->get( 'referer' ) )
//				$this->restart( $referer );
			$this->restart( './' );
		}
	}
}
?>